﻿using System;
using System.Collections;
using jSLCore.Client.Presentation.BaseControl.Selection;

namespace jSLApp.Client.Forms
{
    public partial class LogList : SelectControl
    {
        public LogList()
        {
            InitializeComponent();
        }

        public override void LoadInitialData()
        {
            DoWork("Загрузка",(sender, args) =>
                                  {
                                      args.Result = Communication.Proxy.GetLogs();
                                  },(o, eventArgs) =>
                                                        {
                                                            if(eventArgs.Error==null)
                                                            {
                                                                grid.ItemsSource = (IEnumerable) eventArgs.Result;
                                                            }
                                                        });
        }

        public override ISelectableGrid GetSelectableGrid()
        {
            return grid;
        }

        public override bool IsOkVisibleWhenNotSelectable
        {
            get { return false; }
        }

        public override object CancelContentWhenNotSelectable
        {
            get { return "Закрыть"; }
        }

        public override bool IsStandartOkCancelEnabledWhenNotSelectable
        {
            get { return true; }
        }
    }
}
